local Utility = {}

--王表纺绩自定义时机
---@class SixiangChangeDataSpec
---@field target ServerPlayer
---@field direction "__follow"|"__counter"

---@class SixiangChangeData: SixiangChangeDataSpec, TriggerData
local CountryChangeData = TriggerData:subclass("SixiangChangeData")

---@class AfterSixiangChanged: TriggerEvent
---@field data SixiangChangeData
local AfterSixiangChanged = TriggerEvent:subclass("AfterSixiangChanged")

---@alias AfterSixiangChangedFunc fun(self: TriggerEvent, event: AfterSixiangChanged,
---  target: ServerPlayer?, player: ServerPlayer, data: SixiangChangeData)

---@class SkillSkeleton
---@field addEffect fun(self: SkillSkeleton, key: AfterSixiangChanged,
---  data: TrigSkelSpec<AfterSixiangChangedFunc>, attr: TrigSkelAttribute?): SkillSkeleton

Utility.AfterSixiangChanged = AfterSixiangChanged

--刘阿知漂泊自定义时机
---@class CountryChangeDataSpec
---@field from string
---@field to string
---@field target ServerPlayer

---@class CountryChangeData: CountryChangeDataSpec, TriggerData
local CountryChangeData = TriggerData:subclass("CountryChangeData")

---@class AfterCountryChanged: TriggerEvent
---@field data CountryChangeData
local AfterCountryChanged = TriggerEvent:subclass("AfterCountryChanged")

---@alias AfterCountryChangedFunc fun(self: TriggerEvent, event: AfterCountryChanged,
---  target: ServerPlayer?, player: ServerPlayer, data: CountryChangeData)

---@class SkillSkeleton
---@field addEffect fun(self: SkillSkeleton, key: AfterCountryChanged,
---  data: TrigSkelSpec<AfterCountryChangedFunc>, attr: TrigSkelAttribute?): SkillSkeleton

Utility.AfterCountryChanged = AfterCountryChanged

--销毁时机
---@class BurnCardsDataSpec
---@field from ServerPlayer
---@field cards integer[]

---@class BurnCardsData: BurnCardsDataSpec, TriggerData
local BurnCardsData = TriggerData:subclass("CountryChangeData")

---@class AfterBurnCards: TriggerEvent
---@field data BurnCardsData
local AfterBurnCards = TriggerEvent:subclass("AfterBurnCards")

---@alias AfterBurnCardsFunc fun(self: TriggerEvent, event: AfterBurnCards,
---  target: ServerPlayer?, player: ServerPlayer, data: BurnCardsData)

---@class SkillSkeleton
---@field addEffect fun(self: SkillSkeleton, key: AfterBurnCards,
---  data: TrigSkelSpec<AfterBurnCardsFunc>, attr: TrigSkelAttribute?): SkillSkeleton

Utility.AfterBurnCards = AfterBurnCards

---销毁某些牌并触发相应时机
---@param room Room 房间
---@param cards integer[] 销毁的牌
---@param player ServerPlayer 谁来销毁
---@param skill_name string? 技能名
Utility.burnCards = function (room, cards, player, skill_name)
  skill_name = skill_name or "justBurnCards"
  room:moveCardTo(cards, Card.Void, nil, fk.ReasonJustMove, skill_name, nil, true, player, { "@@burnCards-inarea", { Card.Void } })
  local data = {
    from = player,
    cards = cards,
  }
  room:sendLog{
    type = "#BurnCardsLog",
    from = player.id,
    card = cards
  }
  room.logic:trigger(Utility.AfterBurnCards, player, data)
end
Fk:loadTranslationTable{
  ["#BurnCardsLog"] = "%from 销毁了 %cards",
  ["@@burnCards-inarea"] = "被销毁",
}

return Utility